package com.example.androidapptest;

import android.os.Bundle;
import android.util.Log;
import android.view.View;

import androidx.activity.EdgeToEdge;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.graphics.Insets;
import androidx.core.view.ViewCompat;
import androidx.core.view.WindowInsetsCompat;

import com.example.androidapptest.ollvm.OllvmTest;

public class MainActivity extends AppCompatActivity {
    private final static String TAG = "MainActivity";

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        EdgeToEdge.enable(this);
        setContentView(R.layout.activity_main);
        ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.main), (v, insets) -> {
            Insets systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars());
            v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom);
            return insets;
        });

        findViewById(R.id.btnCalc).setOnClickListener(v -> {
            double result;
            result = OllvmTest.calculate(1, 2, '+');
            Log.i(TAG, "[calc] add:" + result);

            result = OllvmTest.calculate(1, 2, '-');
            Log.i(TAG, "[calc] sub:" + result);

            result = OllvmTest.calculate(1, 2, '*');
            Log.i(TAG, "[calc] mul:" + result);

            result = OllvmTest.calculate(1, 2, '/');
            Log.i(TAG, "[calc] div:" + result);
        });
    }
}